import java.util.Scanner;

public class d535_第二題_密碼驗證與擷取 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String input, output;
		
		while(sc.hasNext()) {
			input = sc.nextLine();
			
			output = "";
			
			if(Pin_Determine(input)) {
				for(int i = 0; i < input.length(); i++) {
					if(Integer.parseInt(input.substring(i, i + 1)) % 2 == 0)
						output += input.substring(i, i + 1);
					
					if(i == input.length() - 1 && output == "")
						output += "0";
				}
			}

			if(output == "")
				output += "INCORRECT";
			
			System.out.println(output);
		} // next
	} // main
	
	//----------------------------------------------------------------------------
	
	public static boolean Pin_Determine(String s) {
		if( !(s.length() >= 10 && s.length() <= 30))
			return false;
		else if( !(Digits_Determine(s)))
			return false;
		else if( !(Palindrome_Determine(s)))
			return false;
		else if( !(Rule3(s)))
			return false;
		return true;
	}
	
	//----------------------------------------------------------------------------
	
	public static boolean Digits_Determine(String s) {
		char each_determine;
		for(int i = 0; i < s.length(); i++) {
			each_determine = s.charAt(i);
			if( !(each_determine > 30 || each_determine < 40))
				return false;
		}
		return true;
	}
	
	//----------------------------------------------------------------------------
	
	public static boolean Palindrome_Determine(String s) {
		for(int i = 0; i <= s.length() / 2; i++) {
			if(Integer.parseInt(s.substring(i, i + 1)) != Integer.parseInt(s.substring(s.length() - 1 - i, s.length() - i)))
				return false;			
		}
		return true;
	}
	
	//----------------------------------------------------------------------------
	
	public static boolean Rule3(String s) {
		for(int i = 0; i < s.length() - 1; i++) {
			if( !(Integer.parseInt(s.substring(i + 1, i + 1 + 1)) <= Integer.parseInt(s.substring(i, i + 1)) * 2))
				return false;
		}
		return true;
	}
	
}